<?php
namespace app\demo\controller;
use app\BaseController;
use app\common\business\Demo;
use app\Request;

class Index extends BaseController
{
    public function index(Request $request)
    {

        $categoryId = $request->param("category_id",0,"intval");
        if(empty($categoryId)){
            return show(config("status.error"),"参数错误");
        }

        $demo = new Demo();
        $results = $demo->getDemoDataByCategoryId($categoryId);

        return show(config("status.success"),"ok",$results);
    }

    public function show()
    {
        throw new \think\exception\HttpException(400,"找不到资源");

    }


    public function abc()
    {
        dump(9);
    }
}